/**
 * Copyright (c) 2010, QinJian
 * All rights reserved.
 */
package com.q.course.dao.arrange;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.q.course.entity.arrange.Arrange;

/**
 * @author 覃健,Email:j411@qq.com
 *
 */
public interface ArrangeDao extends PagingAndSortingRepository<Arrange, Long>, JpaSpecificationExecutor<Arrange> {

	List<Arrange> findByStartTimeBetweenAndExistState( Date sdate, Date edate, Boolean bool  );
	List<Arrange> findByStartTimeBetweenAndExistStateAndTeacherId( Date sdate, Date edate, Boolean bool, Long uid  );
	
	@Query("select count(a.id) from Arrange a where a.existState=true and a.classesId=?1 and a.courseId=?2")
	Long getCourseNumber( Long classid , Long courseid );
	
	Arrange findByIdAndExistState(Long id, Boolean b);
	
}
